
package com.calendar.guos.client.maps;

import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.maps.client.Maps;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TabLayoutPanel;

/**
 * @author Amara Daal
 * 
 */
public class Gmaps extends TabLayoutPanel {

	private Label label;
	private static int tabSize = 20;
	private static String gMapTab = "Campus Map";

	public Gmaps(final String width, final String height) {
		// super(Unit.PX);
		super(tabSize, Unit.PX);

		/*
		 * Asynchronously loads the Maps API. The first parameter should be a
		 * valid Maps API Key to deploy this application on a public server, but
		 * a blank key will work for an application served from localhost.
		 */
		Maps.loadMapsApi("", "2", false, new Runnable() {
			public void run() {
				buildGmapUI(width, height);
			}
		});
		// TODO: this doesn't display anything right now give the tab a name
		// later
		if (this.getSelectedIndex() != -1) {
			this.setTabText(this.getSelectedIndex(), gMapTab);
		}
	}

	private void buildGmapUI(String width, String height) {
		MarkerInfoWindowDemo campusMap = new MarkerInfoWindowDemo();

		this.setSize(width, height);
		this.add(campusMap.map);

		// mainViewPanel.add(map);
		// gMapsPanel.add(map, "googleMap");

		// Add the map to the HTML host page
		// RootLayoutPanel.get().add(gMapsDockPanel);

	}

}
